﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.ComputeShader
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System;
using System.Runtime.CompilerServices;
using UnityEngine.Bindings;
using UnityEngine.Internal;
using UnityEngine.Rendering;
using UnityEngine.Scripting;

#nullable disable
namespace UnityEngine
{
  /// <summary>
  ///   <para>Compute Shader asset.</para>
  /// </summary>
  [NativeHeader("Runtime/Shaders/ComputeShader.h")]
  [UsedByNativeCode]
  [NativeHeader("Runtime/Graphics/ShaderScriptBindings.h")]
  public sealed class ComputeShader : Object
  {
    /// <summary>
    ///   <para>Find ComputeShader kernel index.</para>
    /// </summary>
    /// <param name="name">Name of kernel function.</param>
    /// <returns>
    ///   <para>The Kernel index. If the kernel is not found, Unity logs a "FindKernel failed" error message and raises an ArgumentException.</para>
    /// </returns>
    [NativeMethod(Name = "ComputeShaderScripting::FindKernel", HasExplicitThis = true, IsFreeFunction = true, ThrowsException = true)]
    [RequiredByNativeCode]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern int FindKernel(string name);

    /// <summary>
    ///   <para>Checks whether a shader contains a given kernel.</para>
    /// </summary>
    /// <param name="name">The name of the kernel to look for.</param>
    /// <returns>
    ///   <para>True if the kernel is found, false otherwise.</para>
    /// </returns>
    [FreeFunction(Name = "ComputeShaderScripting::HasKernel", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern bool HasKernel(string name);

    /// <summary>
    ///   <para>Set a float parameter.</para>
    /// </summary>
    /// <param name="name">Variable name in shader code.</param>
    /// <param name="nameID">Property name ID, use Shader.PropertyToID to get it.</param>
    /// <param name="val">Value to set.</param>
    [FreeFunction(Name = "ComputeShaderScripting::SetValue<float>", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern void SetFloat(int nameID, float val);

    /// <summary>
    ///   <para>Set an integer parameter.</para>
    /// </summary>
    /// <param name="name">Variable name in shader code.</param>
    /// <param name="nameID">Property name ID, use Shader.PropertyToID to get it.</param>
    /// <param name="val">Value to set.</param>
    [FreeFunction(Name = "ComputeShaderScripting::SetValue<int>", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern void SetInt(int nameID, int val);

    /// <summary>
    ///   <para>Set a vector parameter.</para>
    /// </summary>
    /// <param name="name">Variable name in shader code.</param>
    /// <param name="nameID">Property name ID, use Shader.PropertyToID to get it.</param>
    /// <param name="val">Value to set.</param>
    [FreeFunction(Name = "ComputeShaderScripting::SetValue<Vector4f>", HasExplicitThis = true)]
    public void SetVector(int nameID, Vector4 val) => this.SetVector_Injected(nameID, ref val);

    /// <summary>
    ///   <para>Set a Matrix parameter.</para>
    /// </summary>
    /// <param name="name">Variable name in shader code.</param>
    /// <param name="nameID">Property name ID, use Shader.PropertyToID to get it.</param>
    /// <param name="val">Value to set.</param>
    [FreeFunction(Name = "ComputeShaderScripting::SetValue<Matrix4x4f>", HasExplicitThis = true)]
    public void SetMatrix(int nameID, Matrix4x4 val) => this.SetMatrix_Injected(nameID, ref val);

    [FreeFunction(Name = "ComputeShaderScripting::SetArray<float>", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void SetFloatArray(int nameID, float[] values);

    [FreeFunction(Name = "ComputeShaderScripting::SetArray<int>", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void SetIntArray(int nameID, int[] values);

    /// <summary>
    ///   <para>Set a vector array parameter.</para>
    /// </summary>
    /// <param name="name">Variable name in shader code.</param>
    /// <param name="nameID">Property name ID, use Shader.PropertyToID to get it.</param>
    /// <param name="values">Value to set.</param>
    [FreeFunction(Name = "ComputeShaderScripting::SetArray<Vector4f>", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern void SetVectorArray(int nameID, Vector4[] values);

    /// <summary>
    ///   <para>Set a Matrix array parameter.</para>
    /// </summary>
    /// <param name="name">Variable name in shader code.</param>
    /// <param name="nameID">Property name ID, use Shader.PropertyToID to get it.</param>
    /// <param name="values">Value to set.</param>
    [FreeFunction(Name = "ComputeShaderScripting::SetArray<Matrix4x4f>", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern void SetMatrixArray(int nameID, Matrix4x4[] values);

    /// <summary>
    ///   <para>Set a texture parameter.</para>
    /// </summary>
    /// <param name="kernelIndex">For which kernel the texture is being set. See FindKernel.</param>
    /// <param name="nameID">Property name ID, use Shader.PropertyToID to get it.</param>
    /// <param name="name">Name of the buffer variable in shader code.</param>
    /// <param name="texture">Texture to set.</param>
    /// <param name="mipLevel">Optional mipmap level of the read-write texture.</param>
    /// <param name="element">Optional parameter that specifies the type of data to set from the RenderTexture.</param>
    [NativeMethod(Name = "ComputeShaderScripting::SetTexture", HasExplicitThis = true, IsFreeFunction = true, ThrowsException = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern void SetTexture(int kernelIndex, int nameID, [NotNull("ArgumentNullException")] Texture texture, int mipLevel);

    [NativeMethod(Name = "ComputeShaderScripting::SetRenderTexture", HasExplicitThis = true, IsFreeFunction = true, ThrowsException = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void SetRenderTexture(
      int kernelIndex,
      int nameID,
      [NotNull("ArgumentNullException")] RenderTexture texture,
      int mipLevel,
      RenderTextureSubElement element);

    /// <summary>
    ///   <para>Set a texture parameter from a global texture property.</para>
    /// </summary>
    /// <param name="kernelIndex">For which kernel the texture is being set. See FindKernel.</param>
    /// <param name="nameID">Property name ID, use Shader.PropertyToID to get it.</param>
    /// <param name="name">Name of the buffer variable in shader code.</param>
    /// <param name="globalTextureName">Global texture property to assign to shader.</param>
    /// <param name="globalTextureNameID">Property name ID, use Shader.PropertyToID to get it.</param>
    [NativeMethod(Name = "ComputeShaderScripting::SetTextureFromGlobal", HasExplicitThis = true, IsFreeFunction = true, ThrowsException = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern void SetTextureFromGlobal(int kernelIndex, int nameID, int globalTextureNameID);

    [FreeFunction(Name = "ComputeShaderScripting::SetBuffer", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void Internal_SetBuffer(int kernelIndex, int nameID, [NotNull("ArgumentNullException")] ComputeBuffer buffer);

    [FreeFunction(Name = "ComputeShaderScripting::SetBuffer", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void Internal_SetGraphicsBuffer(
      int kernelIndex,
      int nameID,
      [NotNull("ArgumentNullException")] GraphicsBuffer buffer);

    /// <summary>
    ///   <para>Sets an input or output compute buffer.</para>
    /// </summary>
    /// <param name="kernelIndex">For which kernel the buffer is being set. See FindKernel.</param>
    /// <param name="nameID">Property name ID, use Shader.PropertyToID to get it.</param>
    /// <param name="name">Name of the buffer variable in shader code.</param>
    /// <param name="buffer">Buffer to set.</param>
    public void SetBuffer(int kernelIndex, int nameID, ComputeBuffer buffer)
    {
      this.Internal_SetBuffer(kernelIndex, nameID, buffer);
    }

    /// <summary>
    ///   <para>Sets an input or output compute buffer.</para>
    /// </summary>
    /// <param name="kernelIndex">For which kernel the buffer is being set. See FindKernel.</param>
    /// <param name="nameID">Property name ID, use Shader.PropertyToID to get it.</param>
    /// <param name="name">Name of the buffer variable in shader code.</param>
    /// <param name="buffer">Buffer to set.</param>
    public void SetBuffer(int kernelIndex, int nameID, GraphicsBuffer buffer)
    {
      this.Internal_SetGraphicsBuffer(kernelIndex, nameID, buffer);
    }

    [FreeFunction(Name = "ComputeShaderScripting::SetConstantBuffer", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void SetConstantComputeBuffer(
      int nameID,
      [NotNull("ArgumentNullException")] ComputeBuffer buffer,
      int offset,
      int size);

    [FreeFunction(Name = "ComputeShaderScripting::SetConstantBuffer", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void SetConstantGraphicsBuffer(
      int nameID,
      [NotNull("ArgumentNullException")] GraphicsBuffer buffer,
      int offset,
      int size);

    [NativeMethod(Name = "ComputeShaderScripting::GetKernelThreadGroupSizes", HasExplicitThis = true, IsFreeFunction = true, ThrowsException = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern void GetKernelThreadGroupSizes(
      int kernelIndex,
      out uint x,
      out uint y,
      out uint z);

    /// <summary>
    ///   <para>Execute a compute shader.</para>
    /// </summary>
    /// <param name="kernelIndex">Which kernel to execute. A single compute shader asset can have multiple kernel entry points.</param>
    /// <param name="threadGroupsX">Number of work groups in the X dimension.</param>
    /// <param name="threadGroupsY">Number of work groups in the Y dimension.</param>
    /// <param name="threadGroupsZ">Number of work groups in the Z dimension.</param>
    [NativeName("DispatchComputeShader")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern void Dispatch(
      int kernelIndex,
      int threadGroupsX,
      int threadGroupsY,
      int threadGroupsZ);

    [FreeFunction(Name = "ComputeShaderScripting::DispatchIndirect", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void Internal_DispatchIndirect(
      int kernelIndex,
      [NotNull("ArgumentNullException")] ComputeBuffer argsBuffer,
      uint argsOffset);

    [FreeFunction(Name = "ComputeShaderScripting::DispatchIndirect", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void Internal_DispatchIndirectGraphicsBuffer(
      int kernelIndex,
      [NotNull("ArgumentNullException")] GraphicsBuffer argsBuffer,
      uint argsOffset);

    /// <summary>
    ///   <para>The local keyword space of this compute shader.</para>
    /// </summary>
    public LocalKeywordSpace keywordSpace
    {
      get
      {
        LocalKeywordSpace ret;
        this.get_keywordSpace_Injected(out ret);
        return ret;
      }
    }

    /// <summary>
    ///   <para>Enables a local shader keyword for this compute shader.</para>
    /// </summary>
    /// <param name="keyword">The Rendering.LocalKeyword to enable.</param>
    /// <param name="keyword">The name of the Rendering.LocalKeyword to enable.</param>
    [FreeFunction("ComputeShaderScripting::EnableKeyword", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern void EnableKeyword(string keyword);

    /// <summary>
    ///   <para>Disables a local shader keyword for this compute shader.</para>
    /// </summary>
    /// <param name="keyword">The Rendering.LocalKeyword to disable.</param>
    /// <param name="keyword">The name of the Rendering.LocalKeyword to disable.</param>
    [FreeFunction("ComputeShaderScripting::DisableKeyword", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern void DisableKeyword(string keyword);

    /// <summary>
    ///   <para>Checks whether a local shader keyword is enabled for this compute shader.</para>
    /// </summary>
    /// <param name="keyword">The Rendering.LocalKeyword to check.</param>
    /// <param name="keyword">The name of the Rendering.LocalKeyword to check.</param>
    /// <returns>
    ///   <para>Returns true if the given Rendering.LocalKeyword is enabled for this compute shader. Otherwise, returns false.</para>
    /// </returns>
    [FreeFunction("ComputeShaderScripting::IsKeywordEnabled", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern bool IsKeywordEnabled(string keyword);

    [FreeFunction("ComputeShaderScripting::EnableKeyword", HasExplicitThis = true)]
    private void EnableLocalKeyword(LocalKeyword keyword)
    {
      this.EnableLocalKeyword_Injected(ref keyword);
    }

    [FreeFunction("ComputeShaderScripting::DisableKeyword", HasExplicitThis = true)]
    private void DisableLocalKeyword(LocalKeyword keyword)
    {
      this.DisableLocalKeyword_Injected(ref keyword);
    }

    [FreeFunction("ComputeShaderScripting::SetKeyword", HasExplicitThis = true)]
    private void SetLocalKeyword(LocalKeyword keyword, bool value)
    {
      this.SetLocalKeyword_Injected(ref keyword, value);
    }

    [FreeFunction("ComputeShaderScripting::IsKeywordEnabled", HasExplicitThis = true)]
    private bool IsLocalKeywordEnabled(LocalKeyword keyword)
    {
      return this.IsLocalKeywordEnabled_Injected(ref keyword);
    }

    public void EnableKeyword(in LocalKeyword keyword) => this.EnableLocalKeyword(keyword);

    public void DisableKeyword(in LocalKeyword keyword) => this.DisableLocalKeyword(keyword);

    public void SetKeyword(in LocalKeyword keyword, bool value)
    {
      this.SetLocalKeyword(keyword, value);
    }

    public bool IsKeywordEnabled(in LocalKeyword keyword) => this.IsLocalKeywordEnabled(keyword);

    /// <summary>
    ///   <para>Allows you to check whether the current end user device supports the features required to run the specified compute shader kernel.</para>
    /// </summary>
    /// <param name="kernelIndex">Which kernel to query.</param>
    /// <returns>
    ///   <para>True if the specified compute kernel is able to run on the current end user device, false otherwise.</para>
    /// </returns>
    [FreeFunction("ComputeShaderScripting::IsSupported", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern bool IsSupported(int kernelIndex);

    [FreeFunction("ComputeShaderScripting::GetShaderKeywords", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern string[] GetShaderKeywords();

    [FreeFunction("ComputeShaderScripting::SetShaderKeywords", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void SetShaderKeywords(string[] names);

    /// <summary>
    ///   <para>An array containing names of the local shader keywords that are currently enabled for this compute shader.</para>
    /// </summary>
    public string[] shaderKeywords
    {
      get => this.GetShaderKeywords();
      set => this.SetShaderKeywords(value);
    }

    [FreeFunction("ComputeShaderScripting::GetEnabledKeywords", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern LocalKeyword[] GetEnabledKeywords();

    [FreeFunction("ComputeShaderScripting::SetEnabledKeywords", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void SetEnabledKeywords(LocalKeyword[] keywords);

    /// <summary>
    ///   <para>An array containing the local shader keywords that are currently enabled for this compute shader.</para>
    /// </summary>
    public LocalKeyword[] enabledKeywords
    {
      get => this.GetEnabledKeywords();
      set => this.SetEnabledKeywords(value);
    }

    private ComputeShader()
    {
    }

    /// <summary>
    ///   <para>Set a float parameter.</para>
    /// </summary>
    /// <param name="name">Variable name in shader code.</param>
    /// <param name="nameID">Property name ID, use Shader.PropertyToID to get it.</param>
    /// <param name="val">Value to set.</param>
    public void SetFloat(string name, float val) => this.SetFloat(Shader.PropertyToID(name), val);

    /// <summary>
    ///   <para>Set an integer parameter.</para>
    /// </summary>
    /// <param name="name">Variable name in shader code.</param>
    /// <param name="nameID">Property name ID, use Shader.PropertyToID to get it.</param>
    /// <param name="val">Value to set.</param>
    public void SetInt(string name, int val) => this.SetInt(Shader.PropertyToID(name), val);

    /// <summary>
    ///   <para>Set a vector parameter.</para>
    /// </summary>
    /// <param name="name">Variable name in shader code.</param>
    /// <param name="nameID">Property name ID, use Shader.PropertyToID to get it.</param>
    /// <param name="val">Value to set.</param>
    public void SetVector(string name, Vector4 val)
    {
      this.SetVector(Shader.PropertyToID(name), val);
    }

    /// <summary>
    ///   <para>Set a Matrix parameter.</para>
    /// </summary>
    /// <param name="name">Variable name in shader code.</param>
    /// <param name="nameID">Property name ID, use Shader.PropertyToID to get it.</param>
    /// <param name="val">Value to set.</param>
    public void SetMatrix(string name, Matrix4x4 val)
    {
      this.SetMatrix(Shader.PropertyToID(name), val);
    }

    /// <summary>
    ///   <para>Set a vector array parameter.</para>
    /// </summary>
    /// <param name="name">Variable name in shader code.</param>
    /// <param name="nameID">Property name ID, use Shader.PropertyToID to get it.</param>
    /// <param name="values">Value to set.</param>
    public void SetVectorArray(string name, Vector4[] values)
    {
      this.SetVectorArray(Shader.PropertyToID(name), values);
    }

    /// <summary>
    ///   <para>Set a Matrix array parameter.</para>
    /// </summary>
    /// <param name="name">Variable name in shader code.</param>
    /// <param name="nameID">Property name ID, use Shader.PropertyToID to get it.</param>
    /// <param name="values">Value to set.</param>
    public void SetMatrixArray(string name, Matrix4x4[] values)
    {
      this.SetMatrixArray(Shader.PropertyToID(name), values);
    }

    /// <summary>
    ///   <para>Set multiple consecutive float parameters at once.</para>
    /// </summary>
    /// <param name="name">Array variable name in the shader code.</param>
    /// <param name="nameID">Property name ID, use Shader.PropertyToID to get it.</param>
    /// <param name="values">Value array to set.</param>
    public void SetFloats(string name, params float[] values)
    {
      this.SetFloatArray(Shader.PropertyToID(name), values);
    }

    /// <summary>
    ///   <para>Set multiple consecutive float parameters at once.</para>
    /// </summary>
    /// <param name="name">Array variable name in the shader code.</param>
    /// <param name="nameID">Property name ID, use Shader.PropertyToID to get it.</param>
    /// <param name="values">Value array to set.</param>
    public void SetFloats(int nameID, params float[] values) => this.SetFloatArray(nameID, values);

    /// <summary>
    ///   <para>Set multiple consecutive integer parameters at once.</para>
    /// </summary>
    /// <param name="name">Array variable name in the shader code.</param>
    /// <param name="nameID">Property name ID, use Shader.PropertyToID to get it.</param>
    /// <param name="values">Value array to set.</param>
    public void SetInts(string name, params int[] values)
    {
      this.SetIntArray(Shader.PropertyToID(name), values);
    }

    /// <summary>
    ///   <para>Set multiple consecutive integer parameters at once.</para>
    /// </summary>
    /// <param name="name">Array variable name in the shader code.</param>
    /// <param name="nameID">Property name ID, use Shader.PropertyToID to get it.</param>
    /// <param name="values">Value array to set.</param>
    public void SetInts(int nameID, params int[] values) => this.SetIntArray(nameID, values);

    /// <summary>
    ///   <para>Set a bool parameter.</para>
    /// </summary>
    /// <param name="name">Variable name in shader code.</param>
    /// <param name="nameID">Property name ID, use Shader.PropertyToID to get it.</param>
    /// <param name="val">Value to set.</param>
    public void SetBool(string name, bool val)
    {
      this.SetInt(Shader.PropertyToID(name), val ? 1 : 0);
    }

    /// <summary>
    ///   <para>Set a bool parameter.</para>
    /// </summary>
    /// <param name="name">Variable name in shader code.</param>
    /// <param name="nameID">Property name ID, use Shader.PropertyToID to get it.</param>
    /// <param name="val">Value to set.</param>
    public void SetBool(int nameID, bool val) => this.SetInt(nameID, val ? 1 : 0);

    /// <summary>
    ///   <para>Set a texture parameter.</para>
    /// </summary>
    /// <param name="kernelIndex">For which kernel the texture is being set. See FindKernel.</param>
    /// <param name="nameID">Property name ID, use Shader.PropertyToID to get it.</param>
    /// <param name="name">Name of the buffer variable in shader code.</param>
    /// <param name="texture">Texture to set.</param>
    /// <param name="mipLevel">Optional mipmap level of the read-write texture.</param>
    /// <param name="element">Optional parameter that specifies the type of data to set from the RenderTexture.</param>
    public void SetTexture(int kernelIndex, int nameID, Texture texture)
    {
      this.SetTexture(kernelIndex, nameID, texture, 0);
    }

    /// <summary>
    ///   <para>Set a texture parameter.</para>
    /// </summary>
    /// <param name="kernelIndex">For which kernel the texture is being set. See FindKernel.</param>
    /// <param name="nameID">Property name ID, use Shader.PropertyToID to get it.</param>
    /// <param name="name">Name of the buffer variable in shader code.</param>
    /// <param name="texture">Texture to set.</param>
    /// <param name="mipLevel">Optional mipmap level of the read-write texture.</param>
    /// <param name="element">Optional parameter that specifies the type of data to set from the RenderTexture.</param>
    public void SetTexture(int kernelIndex, string name, Texture texture)
    {
      this.SetTexture(kernelIndex, Shader.PropertyToID(name), texture, 0);
    }

    /// <summary>
    ///   <para>Set a texture parameter.</para>
    /// </summary>
    /// <param name="kernelIndex">For which kernel the texture is being set. See FindKernel.</param>
    /// <param name="nameID">Property name ID, use Shader.PropertyToID to get it.</param>
    /// <param name="name">Name of the buffer variable in shader code.</param>
    /// <param name="texture">Texture to set.</param>
    /// <param name="mipLevel">Optional mipmap level of the read-write texture.</param>
    /// <param name="element">Optional parameter that specifies the type of data to set from the RenderTexture.</param>
    public void SetTexture(int kernelIndex, string name, Texture texture, int mipLevel)
    {
      this.SetTexture(kernelIndex, Shader.PropertyToID(name), texture, mipLevel);
    }

    /// <summary>
    ///   <para>Set a texture parameter.</para>
    /// </summary>
    /// <param name="kernelIndex">For which kernel the texture is being set. See FindKernel.</param>
    /// <param name="nameID">Property name ID, use Shader.PropertyToID to get it.</param>
    /// <param name="name">Name of the buffer variable in shader code.</param>
    /// <param name="texture">Texture to set.</param>
    /// <param name="mipLevel">Optional mipmap level of the read-write texture.</param>
    /// <param name="element">Optional parameter that specifies the type of data to set from the RenderTexture.</param>
    public void SetTexture(
      int kernelIndex,
      int nameID,
      RenderTexture texture,
      int mipLevel,
      RenderTextureSubElement element)
    {
      this.SetRenderTexture(kernelIndex, nameID, texture, mipLevel, element);
    }

    /// <summary>
    ///   <para>Set a texture parameter.</para>
    /// </summary>
    /// <param name="kernelIndex">For which kernel the texture is being set. See FindKernel.</param>
    /// <param name="nameID">Property name ID, use Shader.PropertyToID to get it.</param>
    /// <param name="name">Name of the buffer variable in shader code.</param>
    /// <param name="texture">Texture to set.</param>
    /// <param name="mipLevel">Optional mipmap level of the read-write texture.</param>
    /// <param name="element">Optional parameter that specifies the type of data to set from the RenderTexture.</param>
    public void SetTexture(
      int kernelIndex,
      string name,
      RenderTexture texture,
      int mipLevel,
      RenderTextureSubElement element)
    {
      this.SetRenderTexture(kernelIndex, Shader.PropertyToID(name), texture, mipLevel, element);
    }

    /// <summary>
    ///   <para>Set a texture parameter from a global texture property.</para>
    /// </summary>
    /// <param name="kernelIndex">For which kernel the texture is being set. See FindKernel.</param>
    /// <param name="nameID">Property name ID, use Shader.PropertyToID to get it.</param>
    /// <param name="name">Name of the buffer variable in shader code.</param>
    /// <param name="globalTextureName">Global texture property to assign to shader.</param>
    /// <param name="globalTextureNameID">Property name ID, use Shader.PropertyToID to get it.</param>
    public void SetTextureFromGlobal(int kernelIndex, string name, string globalTextureName)
    {
      this.SetTextureFromGlobal(kernelIndex, Shader.PropertyToID(name), Shader.PropertyToID(globalTextureName));
    }

    /// <summary>
    ///   <para>Sets an input or output compute buffer.</para>
    /// </summary>
    /// <param name="kernelIndex">For which kernel the buffer is being set. See FindKernel.</param>
    /// <param name="nameID">Property name ID, use Shader.PropertyToID to get it.</param>
    /// <param name="name">Name of the buffer variable in shader code.</param>
    /// <param name="buffer">Buffer to set.</param>
    public void SetBuffer(int kernelIndex, string name, ComputeBuffer buffer)
    {
      this.SetBuffer(kernelIndex, Shader.PropertyToID(name), buffer);
    }

    /// <summary>
    ///   <para>Sets an input or output compute buffer.</para>
    /// </summary>
    /// <param name="kernelIndex">For which kernel the buffer is being set. See FindKernel.</param>
    /// <param name="nameID">Property name ID, use Shader.PropertyToID to get it.</param>
    /// <param name="name">Name of the buffer variable in shader code.</param>
    /// <param name="buffer">Buffer to set.</param>
    public void SetBuffer(int kernelIndex, string name, GraphicsBuffer buffer)
    {
      this.SetBuffer(kernelIndex, Shader.PropertyToID(name), buffer);
    }

    /// <summary>
    ///   <para>Sets a ComputeBuffer or GraphicsBuffer as a named constant buffer for the ComputeShader.</para>
    /// </summary>
    /// <param name="nameID">The ID of the property name for the constant buffer in shader code. Use Shader.PropertyToID to get this ID.</param>
    /// <param name="name">The name of the buffer to bind as constant buffer.</param>
    /// <param name="buffer">The buffer to bind as constant buffer.</param>
    /// <param name="offset">The offset in bytes from the beginning of the ComputeBuffer to bind. Must be a multiple of SystemInfo.constantBufferOffsetAlignment, or 0 if that value is 0.</param>
    /// <param name="size">The number of bytes to bind.</param>
    public void SetConstantBuffer(int nameID, ComputeBuffer buffer, int offset, int size)
    {
      this.SetConstantComputeBuffer(nameID, buffer, offset, size);
    }

    /// <summary>
    ///   <para>Sets a ComputeBuffer or GraphicsBuffer as a named constant buffer for the ComputeShader.</para>
    /// </summary>
    /// <param name="nameID">The ID of the property name for the constant buffer in shader code. Use Shader.PropertyToID to get this ID.</param>
    /// <param name="name">The name of the buffer to bind as constant buffer.</param>
    /// <param name="buffer">The buffer to bind as constant buffer.</param>
    /// <param name="offset">The offset in bytes from the beginning of the ComputeBuffer to bind. Must be a multiple of SystemInfo.constantBufferOffsetAlignment, or 0 if that value is 0.</param>
    /// <param name="size">The number of bytes to bind.</param>
    public void SetConstantBuffer(string name, ComputeBuffer buffer, int offset, int size)
    {
      this.SetConstantBuffer(Shader.PropertyToID(name), buffer, offset, size);
    }

    /// <summary>
    ///   <para>Sets a ComputeBuffer or GraphicsBuffer as a named constant buffer for the ComputeShader.</para>
    /// </summary>
    /// <param name="nameID">The ID of the property name for the constant buffer in shader code. Use Shader.PropertyToID to get this ID.</param>
    /// <param name="name">The name of the buffer to bind as constant buffer.</param>
    /// <param name="buffer">The buffer to bind as constant buffer.</param>
    /// <param name="offset">The offset in bytes from the beginning of the ComputeBuffer to bind. Must be a multiple of SystemInfo.constantBufferOffsetAlignment, or 0 if that value is 0.</param>
    /// <param name="size">The number of bytes to bind.</param>
    public void SetConstantBuffer(int nameID, GraphicsBuffer buffer, int offset, int size)
    {
      this.SetConstantGraphicsBuffer(nameID, buffer, offset, size);
    }

    /// <summary>
    ///   <para>Sets a ComputeBuffer or GraphicsBuffer as a named constant buffer for the ComputeShader.</para>
    /// </summary>
    /// <param name="nameID">The ID of the property name for the constant buffer in shader code. Use Shader.PropertyToID to get this ID.</param>
    /// <param name="name">The name of the buffer to bind as constant buffer.</param>
    /// <param name="buffer">The buffer to bind as constant buffer.</param>
    /// <param name="offset">The offset in bytes from the beginning of the ComputeBuffer to bind. Must be a multiple of SystemInfo.constantBufferOffsetAlignment, or 0 if that value is 0.</param>
    /// <param name="size">The number of bytes to bind.</param>
    public void SetConstantBuffer(string name, GraphicsBuffer buffer, int offset, int size)
    {
      this.SetConstantBuffer(Shader.PropertyToID(name), buffer, offset, size);
    }

    /// <summary>
    ///   <para>Execute a compute shader.</para>
    /// </summary>
    /// <param name="kernelIndex">Which kernel to execute. A single compute shader asset can have multiple kernel entry points.</param>
    /// <param name="argsBuffer">Buffer with dispatch arguments.</param>
    /// <param name="argsOffset">The byte offset into the buffer, where the draw arguments start.</param>
    public void DispatchIndirect(int kernelIndex, ComputeBuffer argsBuffer, [DefaultValue("0")] uint argsOffset)
    {
      if (argsBuffer == null)
        throw new ArgumentNullException(nameof (argsBuffer));
      if (argsBuffer.m_Ptr == IntPtr.Zero)
        throw new ObjectDisposedException(nameof (argsBuffer));
      this.Internal_DispatchIndirect(kernelIndex, argsBuffer, argsOffset);
    }

    [ExcludeFromDocs]
    public void DispatchIndirect(int kernelIndex, ComputeBuffer argsBuffer)
    {
      this.DispatchIndirect(kernelIndex, argsBuffer, 0U);
    }

    /// <summary>
    ///   <para>Execute a compute shader.</para>
    /// </summary>
    /// <param name="kernelIndex">Which kernel to execute. A single compute shader asset can have multiple kernel entry points.</param>
    /// <param name="argsBuffer">Buffer with dispatch arguments.</param>
    /// <param name="argsOffset">The byte offset into the buffer, where the draw arguments start.</param>
    public void DispatchIndirect(int kernelIndex, GraphicsBuffer argsBuffer, [DefaultValue("0")] uint argsOffset)
    {
      if (argsBuffer == null)
        throw new ArgumentNullException(nameof (argsBuffer));
      if (argsBuffer.m_Ptr == IntPtr.Zero)
        throw new ObjectDisposedException(nameof (argsBuffer));
      this.Internal_DispatchIndirectGraphicsBuffer(kernelIndex, argsBuffer, argsOffset);
    }

    [ExcludeFromDocs]
    public void DispatchIndirect(int kernelIndex, GraphicsBuffer argsBuffer)
    {
      this.DispatchIndirect(kernelIndex, argsBuffer, 0U);
    }

    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void SetVector_Injected(int nameID, ref Vector4 val);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void SetMatrix_Injected(int nameID, ref Matrix4x4 val);

    [SpecialName]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void get_keywordSpace_Injected(out LocalKeywordSpace ret);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void EnableLocalKeyword_Injected(ref LocalKeyword keyword);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void DisableLocalKeyword_Injected(ref LocalKeyword keyword);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void SetLocalKeyword_Injected(ref LocalKeyword keyword, bool value);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern bool IsLocalKeywordEnabled_Injected(ref LocalKeyword keyword);
  }
}
